<!--
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
The complete set of authors may be found at http://polymer.github.io/AUTHORS
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
-->

<!--
Use to create nested menus inside of `core-menu` elements.

    <core-menu selected="0">
    
      <core-submenu icon="settings" label="Topics">
        <core-item label="Topic 1"></core-item>
        <core-item label="Topic 2"></core-item>
      </core-submenu>
      
      <core-submenu icon="settings" label="Favorites">
        <core-item label="Favorite 1"></core-item>
        <core-item label="Favorite 2"></core-item>
        <core-item label="Favorite 3"></core-item>
      </core-submenu>
      
    </core-menu>
    
There is a margin set on the submenu to indent the items.
You can override the margin by doing:

    core-submenu::shadow #submenu {
      margin-left: 20px;
    }

@group Polymer Core Elements
@element core-submenu
@extends core-item
-->

<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-collapse/core-collapse.html">

<polymer-element name="core-submenu" attributes="selected selectedItem label icon src valueattr">
<template>

  <link rel="stylesheet" href="core-submenu.css">

  <core-item src="{{src}}" label="{{label}}" icon="{{icon}}" class="{{ {'core-selected' : active} | tokenList}}" on-tap="{{activate}}">
    <content select=".item-content"></content>
  </core-item>

  <core-menu id="submenu" selected="{{selected}}" selectedItem="{{selectedItem}}" valueattr="{{valueattr}}">
    <content></content>
  </core-menu>

  <core-collapse target="{{$.submenu}}" opened="{{opened}}"></core-collapse>

</template>
<script src="core-submenu.js"></script>
</polymer-element>
